package org.dxy.infrastructure.persistent.db.mybatispuls.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dxy.infrastructure.persistent.db.mybatispuls.po.FactoryPo;
import org.dxy.infrastructure.persistent.db.mybatispuls.mapper.FactoryMapper;
import org.dxy.infrastructure.persistent.db.mybatispuls.service.FactoryPersistentService;
import org.springframework.stereotype.Service;

/**
 * 工厂持久化服务实现
 */
@Service
public class FactoryPersistentServiceImpl extends ServiceImpl<FactoryMapper, FactoryPo> implements FactoryPersistentService {
    
    @Override
    public boolean existsByFactoryCode(String factoryCode) {
        LambdaQueryWrapper<FactoryPo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(FactoryPo::getFactoryCode, factoryCode);
        return this.count(queryWrapper) > 0;
    }
}